/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pmbs;

import java.awt.CardLayout;
import java.awt.event.MouseEvent;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Robert Yonas
 */
public class frmMain extends javax.swing.JFrame {

    /**
     * Creates new form frmMain
     */
    public frmMain() {
        initComponents();
        CardLayout myLayout = (CardLayout) pnlContainer.getLayout();
        myLayout.first(pnlContainer);
        myLayout.next(pnlContainer);
        refreshCandidateScreen();
    }

  
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        popCompany = new javax.swing.JPopupMenu();
        menuRemove = new javax.swing.JMenuItem();
        menuToggleDone = new javax.swing.JMenuItem();
        btnGroupCandidate = new javax.swing.ButtonGroup();
        btnGroupCompany = new javax.swing.ButtonGroup();
        popCandidate = new javax.swing.JPopupMenu();
        menuRemove2 = new javax.swing.JMenuItem();
        menuToggleDone2 = new javax.swing.JMenuItem();
        btnCandidate = new javax.swing.JButton();
        btnCompany = new javax.swing.JButton();
        btnInterview = new javax.swing.JButton();
        btnLogout = new javax.swing.JButton();
        pnlContainer = new javax.swing.JPanel();
        pnlInterview = new javax.swing.JPanel();
        jSeparator1 = new javax.swing.JSeparator();
        lblCheckIn = new javax.swing.JLabel();
        jLabel1lblCheckOut = new javax.swing.JLabel();
        cbCompanyCheckin = new javax.swing.JComboBox();
        cbCandidate2Checkin = new javax.swing.JComboBox();
        cbCandidate3CheckIn = new javax.swing.JComboBox();
        cbCandidate1Checkin = new javax.swing.JComboBox();
        cbCandidate4CheckIn = new javax.swing.JComboBox();
        btnCheckin1 = new javax.swing.JButton();
        btnCheckIn2 = new javax.swing.JButton();
        btnCheckIn3 = new javax.swing.JButton();
        btnCheckIn4 = new javax.swing.JButton();
        cbCandidateCheckout = new javax.swing.JComboBox();
        btnIdle = new javax.swing.JButton();
        btnOccupied = new javax.swing.JButton();
        lblTitleCompanyCheckIn = new javax.swing.JLabel();
        lblTitleCandidateCheckout = new javax.swing.JLabel();
        lblStatusCheckin = new javax.swing.JLabel();
        lblStatusCheckout = new javax.swing.JLabel();
        tbtnCompanyPresent = new javax.swing.JToggleButton();
        tbtnCandidatePresent = new javax.swing.JToggleButton();
        spinInterviewerCount = new javax.swing.JSpinner();
        cbRoom = new javax.swing.JComboBox();
        lblInterviewerCount = new javax.swing.JLabel();
        lblRoom = new javax.swing.JLabel();
        btnCheckIn5 = new javax.swing.JButton();
        cbCandidate5CheckIn = new javax.swing.JComboBox();
        btnCheckIn6 = new javax.swing.JButton();
        cbCandidate6CheckIn = new javax.swing.JComboBox();
        btnInterviewerUpdate = new javax.swing.JButton();
        pnlCandidate = new javax.swing.JPanel();
        lblCandidateList = new javax.swing.JLabel();
        btnInsertCandidate = new javax.swing.JButton();
        btnUpdateCandidate = new javax.swing.JButton();
        btnDeleteCandidate = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblCandidate = new javax.swing.JTable();
        lblInsertCompany = new javax.swing.JLabel();
        cbCompany = new javax.swing.JComboBox();
        radioCloseCandidate = new javax.swing.JRadioButton();
        radioOpenCandidate = new javax.swing.JRadioButton();
        btnAddCompany2Candidate = new javax.swing.JButton();
        lblCloseSysCompany = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        listCloseSysCompany = new javax.swing.JList();
        lblOpenSysCompany = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        listOpenSysCompany = new javax.swing.JList();
        txtCandidateName = new javax.swing.JTextField();
        btnRefreshCandidateList = new javax.swing.JButton();
        pnlCompany = new javax.swing.JPanel();
        btnInsertCompany = new javax.swing.JButton();
        btnUpdateCompany = new javax.swing.JButton();
        btnDeleteCompany = new javax.swing.JButton();
        lblCompanyList = new javax.swing.JLabel();
        lblInsertCandidate = new javax.swing.JLabel();
        cbCandidate = new javax.swing.JComboBox();
        radioCloseCompany = new javax.swing.JRadioButton();
        radioOpenCompany = new javax.swing.JRadioButton();
        btnAddCandidate2Company = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        listCloseSysCandidate = new javax.swing.JList();
        lblCloseSysCandidate = new javax.swing.JLabel();
        lblOpenSysCandidate = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        listOpenSysCandidate = new javax.swing.JList();
        jScrollPane4 = new javax.swing.JScrollPane();
        tblCompany = new javax.swing.JTable();
        txtCompanyName = new javax.swing.JTextField();
        btnRefreshCompanyList = new javax.swing.JButton();

        menuRemove.setText("Remove");
        menuRemove.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuRemoveActionPerformed(evt);
            }
        });
        popCompany.add(menuRemove);

        menuToggleDone.setText("Toggle Done");
        menuToggleDone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuToggleDoneActionPerformed(evt);
            }
        });
        popCompany.add(menuToggleDone);

        menuRemove2.setText("Remove");
        menuRemove2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuRemove2ActionPerformed(evt);
            }
        });
        popCandidate.add(menuRemove2);

        menuToggleDone2.setText("Toggle Done");
        menuToggleDone2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuToggleDone2ActionPerformed(evt);
            }
        });
        popCandidate.add(menuToggleDone2);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("frmMain");
        setResizable(false);
        setType(java.awt.Window.Type.UTILITY);

        btnCandidate.setFont(new java.awt.Font("BrowalliaUPC", 1, 24)); // NOI18N
        btnCandidate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/User.png"))); // NOI18N
        btnCandidate.setText("Candidate");
        btnCandidate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCandidateActionPerformed(evt);
            }
        });

        btnCompany.setFont(new java.awt.Font("BrowalliaUPC", 1, 24)); // NOI18N
        btnCompany.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Company.png"))); // NOI18N
        btnCompany.setText("Company");
        btnCompany.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCompanyActionPerformed(evt);
            }
        });

        btnInterview.setFont(new java.awt.Font("BrowalliaUPC", 1, 24)); // NOI18N
        btnInterview.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Interview.png"))); // NOI18N
        btnInterview.setText("Interview");
        btnInterview.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInterviewActionPerformed(evt);
            }
        });

        btnLogout.setFont(new java.awt.Font("BrowalliaUPC", 1, 24)); // NOI18N
        btnLogout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Logout.png"))); // NOI18N
        btnLogout.setText("Logout");
        btnLogout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLogoutActionPerformed(evt);
            }
        });

        pnlContainer.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        pnlContainer.setLayout(new java.awt.CardLayout());

        lblCheckIn.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        lblCheckIn.setText("Check In Process");

        jLabel1lblCheckOut.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel1lblCheckOut.setText("Check Out Process (Candidate Process)");

        cbCompanyCheckin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbCompanyCheckinActionPerformed(evt);
            }
        });

        btnCheckin1.setText("Check In");
        btnCheckin1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCheckin1ActionPerformed(evt);
            }
        });

        btnCheckIn2.setText("Check In");
        btnCheckIn2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCheckIn2ActionPerformed(evt);
            }
        });

        btnCheckIn3.setText("Check In");
        btnCheckIn3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCheckIn3ActionPerformed(evt);
            }
        });

        btnCheckIn4.setText("Check In");
        btnCheckIn4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCheckIn4ActionPerformed(evt);
            }
        });

        cbCandidateCheckout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbCandidateCheckoutActionPerformed(evt);
            }
        });

        btnIdle.setText("Checkout (Idle)");
        btnIdle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnIdleActionPerformed(evt);
            }
        });

        btnOccupied.setText("Busy");
        btnOccupied.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOccupiedActionPerformed(evt);
            }
        });

        lblTitleCompanyCheckIn.setText("Company");

        lblTitleCandidateCheckout.setText("Candidate");

        lblStatusCheckin.setText("Status : [Information]");

        lblStatusCheckout.setText("Status : [Information]");

        tbtnCompanyPresent.setText("Present");
        tbtnCompanyPresent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tbtnCompanyPresentActionPerformed(evt);
            }
        });

        tbtnCandidatePresent.setText("Present");
        tbtnCandidatePresent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tbtnCandidatePresentActionPerformed(evt);
            }
        });

        spinInterviewerCount.setModel(new javax.swing.SpinnerNumberModel(1, 1, 6, 1));

        cbRoom.setEditable(true);

        lblInterviewerCount.setText("Number of Interviewer");

        lblRoom.setText("Room");

        btnCheckIn5.setText("Check In");
        btnCheckIn5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCheckIn5ActionPerformed(evt);
            }
        });

        btnCheckIn6.setText("Check In");
        btnCheckIn6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCheckIn6ActionPerformed(evt);
            }
        });

        btnInterviewerUpdate.setText("Update");
        btnInterviewerUpdate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInterviewerUpdateActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlInterviewLayout = new javax.swing.GroupLayout(pnlInterview);
        pnlInterview.setLayout(pnlInterviewLayout);
        pnlInterviewLayout.setHorizontalGroup(
            pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlInterviewLayout.createSequentialGroup()
                .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlInterviewLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(pnlInterviewLayout.createSequentialGroup()
                                .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblTitleCompanyCheckIn)
                                    .addComponent(lblTitleCandidateCheckout)
                                    .addComponent(lblStatusCheckin)
                                    .addComponent(lblStatusCheckout)
                                    .addGroup(pnlInterviewLayout.createSequentialGroup()
                                        .addComponent(cbCandidateCheckout, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(btnOccupied)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(btnIdle))
                                    .addGroup(pnlInterviewLayout.createSequentialGroup()
                                        .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(cbCompanyCheckin, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(pnlInterviewLayout.createSequentialGroup()
                                                .addComponent(tbtnCompanyPresent)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(btnInterviewerUpdate))
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                .addGroup(pnlInterviewLayout.createSequentialGroup()
                                                    .addComponent(lblRoom)
                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                    .addComponent(cbRoom, 0, 120, Short.MAX_VALUE))
                                                .addGroup(pnlInterviewLayout.createSequentialGroup()
                                                    .addComponent(lblInterviewerCount)
                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(spinInterviewerCount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                        .addGap(18, 18, 18)
                                        .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(cbCandidate3CheckIn, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(cbCandidate2Checkin, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(cbCandidate4CheckIn, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(cbCandidate1Checkin, 0, 220, Short.MAX_VALUE)
                                            .addComponent(cbCandidate5CheckIn, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(cbCandidate6CheckIn, javax.swing.GroupLayout.Alignment.TRAILING, 0, 220, Short.MAX_VALUE))
                                        .addGap(18, 18, 18)
                                        .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(btnCheckin1)
                                            .addComponent(btnCheckIn2)
                                            .addComponent(btnCheckIn3)
                                            .addComponent(btnCheckIn4)
                                            .addComponent(btnCheckIn5)
                                            .addComponent(btnCheckIn6))))
                                .addGap(0, 0, Short.MAX_VALUE))))
                    .addGroup(pnlInterviewLayout.createSequentialGroup()
                        .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlInterviewLayout.createSequentialGroup()
                                .addGap(193, 193, 193)
                                .addComponent(jLabel1lblCheckOut))
                            .addGroup(pnlInterviewLayout.createSequentialGroup()
                                .addGap(304, 304, 304)
                                .addComponent(lblCheckIn))
                            .addGroup(pnlInterviewLayout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(tbtnCandidatePresent)))
                        .addGap(0, 152, Short.MAX_VALUE)))
                .addContainerGap())
        );
        pnlInterviewLayout.setVerticalGroup(
            pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlInterviewLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblCheckIn)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblTitleCompanyCheckIn)
                .addGap(5, 5, 5)
                .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbCandidate1Checkin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnCheckin1)
                    .addComponent(cbCompanyCheckin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlInterviewLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(spinInterviewerCount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblInterviewerCount)
                            .addComponent(cbCandidate2Checkin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnCheckIn2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cbRoom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblRoom)
                            .addComponent(cbCandidate3CheckIn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnCheckIn3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cbCandidate4CheckIn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnCheckIn4)))
                    .addGroup(pnlInterviewLayout.createSequentialGroup()
                        .addGap(63, 63, 63)
                        .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tbtnCompanyPresent)
                            .addComponent(btnInterviewerUpdate))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbCandidate5CheckIn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnCheckIn5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbCandidate6CheckIn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnCheckIn6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lblStatusCheckin)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1lblCheckOut)
                .addGap(17, 17, 17)
                .addComponent(lblTitleCandidateCheckout)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlInterviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbCandidateCheckout, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnOccupied)
                    .addComponent(btnIdle))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tbtnCandidatePresent)
                .addGap(140, 140, 140)
                .addComponent(lblStatusCheckout)
                .addContainerGap())
        );

        pnlContainer.add(pnlInterview, "card4");

        lblCandidateList.setText("Candidate List");

        btnInsertCandidate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/insert.png"))); // NOI18N
        btnInsertCandidate.setText("Insert");
        btnInsertCandidate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInsertCandidateActionPerformed(evt);
            }
        });

        btnUpdateCandidate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/update.png"))); // NOI18N
        btnUpdateCandidate.setText("Update");
        btnUpdateCandidate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateCandidateActionPerformed(evt);
            }
        });

        btnDeleteCandidate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/delete.png"))); // NOI18N
        btnDeleteCandidate.setText("Delete");
        btnDeleteCandidate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteCandidateActionPerformed(evt);
            }
        });

        tblCandidate.setAutoCreateRowSorter(true);
        tblCandidate.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Name", "isPresent", "isOccupied"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tblCandidate.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                tblCandidateMouseReleased(evt);
            }
        });
        jScrollPane1.setViewportView(tblCandidate);

        lblInsertCompany.setText("Company");

        cbCompany.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                cbCompanyKeyReleased(evt);
            }
        });

        btnGroupCandidate.add(radioCloseCandidate);
        radioCloseCandidate.setSelected(true);
        radioCloseCandidate.setText("Close System");

        btnGroupCandidate.add(radioOpenCandidate);
        radioOpenCandidate.setText("Open System");
        radioOpenCandidate.setDoubleBuffered(true);

        btnAddCompany2Candidate.setText("Add");
        btnAddCompany2Candidate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddCompany2CandidateActionPerformed(evt);
            }
        });

        lblCloseSysCompany.setText("Close System Company");

        listCloseSysCompany.setModel(new DefaultListModel());
        listCloseSysCompany.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        listCloseSysCompany.setComponentPopupMenu(popCompany);
        listCloseSysCompany.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                listCloseSysCompanyFocusGained(evt);
            }
        });
        jScrollPane5.setViewportView(listCloseSysCompany);

        lblOpenSysCompany.setText("Open System Company");

        listOpenSysCompany.setModel(new DefaultListModel());
        listOpenSysCompany.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        listOpenSysCompany.setComponentPopupMenu(popCompany);
        listOpenSysCompany.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                listOpenSysCompanyFocusGained(evt);
            }
        });
        jScrollPane6.setViewportView(listOpenSysCompany);

        txtCandidateName.setToolTipText("");
        txtCandidateName.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtCandidateNameKeyTyped(evt);
            }
        });

        btnRefreshCandidateList.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Refresh.png"))); // NOI18N
        btnRefreshCandidateList.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRefreshCandidateListActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlCandidateLayout = new javax.swing.GroupLayout(pnlCandidate);
        pnlCandidate.setLayout(pnlCandidateLayout);
        pnlCandidateLayout.setHorizontalGroup(
            pnlCandidateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlCandidateLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlCandidateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlCandidateLayout.createSequentialGroup()
                        .addComponent(lblCandidateList)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(pnlCandidateLayout.createSequentialGroup()
                        .addGroup(pnlCandidateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtCandidateName)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlCandidateLayout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(btnRefreshCandidateList)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnInsertCandidate)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnUpdateCandidate)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnDeleteCandidate))
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                        .addGap(15, 15, 15)))
                .addGroup(pnlCandidateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(pnlCandidateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(pnlCandidateLayout.createSequentialGroup()
                            .addComponent(radioCloseCandidate)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(radioOpenCandidate)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(btnAddCompany2Candidate))
                        .addGroup(pnlCandidateLayout.createSequentialGroup()
                            .addGroup(pnlCandidateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(lblInsertCompany)
                                .addComponent(lblCloseSysCompany)
                                .addComponent(lblOpenSysCompany))
                            .addGap(0, 0, Short.MAX_VALUE))
                        .addComponent(cbCompany, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jScrollPane6, javax.swing.GroupLayout.Alignment.TRAILING))
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        pnlCandidateLayout.setVerticalGroup(
            pnlCandidateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlCandidateLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlCandidateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCandidateList)
                    .addComponent(lblInsertCompany))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlCandidateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtCandidateName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbCompany, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
                .addGroup(pnlCandidateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlCandidateLayout.createSequentialGroup()
                        .addGroup(pnlCandidateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(radioCloseCandidate)
                            .addComponent(radioOpenCandidate)
                            .addComponent(btnAddCompany2Candidate))
                        .addGap(18, 18, 18)
                        .addComponent(lblCloseSysCompany)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblOpenSysCompany)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlCandidateLayout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 457, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlCandidateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnRefreshCandidateList)
                            .addGroup(pnlCandidateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(btnInsertCandidate)
                                .addComponent(btnUpdateCandidate)
                                .addComponent(btnDeleteCandidate)))))
                .addGap(0, 7, Short.MAX_VALUE))
        );

        pnlContainer.add(pnlCandidate, "card3");

        pnlCompany.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                pnlCompanyKeyReleased(evt);
            }
        });

        btnInsertCompany.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/insert.png"))); // NOI18N
        btnInsertCompany.setText("Insert");
        btnInsertCompany.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInsertCompanyActionPerformed(evt);
            }
        });

        btnUpdateCompany.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/update.png"))); // NOI18N
        btnUpdateCompany.setText("Update");
        btnUpdateCompany.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateCompanyActionPerformed(evt);
            }
        });

        btnDeleteCompany.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/delete.png"))); // NOI18N
        btnDeleteCompany.setText("Delete");
        btnDeleteCompany.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteCompanyActionPerformed(evt);
            }
        });

        lblCompanyList.setText("Conpany List");

        lblInsertCandidate.setText("Candidate");

        btnGroupCompany.add(radioCloseCompany);
        radioCloseCompany.setSelected(true);
        radioCloseCompany.setText("Close System");

        btnGroupCompany.add(radioOpenCompany);
        radioOpenCompany.setText("Open System");

        btnAddCandidate2Company.setText("Add");
        btnAddCandidate2Company.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddCandidate2CompanyActionPerformed(evt);
            }
        });

        listCloseSysCandidate.setModel(new DefaultListModel());
        listCloseSysCandidate.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        listCloseSysCandidate.setComponentPopupMenu(popCandidate);
        listCloseSysCandidate.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                listCloseSysCandidateFocusGained(evt);
            }
        });
        jScrollPane2.setViewportView(listCloseSysCandidate);

        lblCloseSysCandidate.setText("Close System Candidate");

        lblOpenSysCandidate.setText("Open System Candidate");

        listOpenSysCandidate.setModel(new DefaultListModel());
        listOpenSysCandidate.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        listOpenSysCandidate.setComponentPopupMenu(popCandidate);
        listOpenSysCandidate.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                listOpenSysCandidateFocusGained(evt);
            }
        });
        jScrollPane3.setViewportView(listOpenSysCandidate);

        tblCompany.setAutoCreateRowSorter(true);
        tblCompany.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Name", "isPresent"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tblCompany.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                tblCompanyMouseReleased(evt);
            }
        });
        jScrollPane4.setViewportView(tblCompany);

        txtCompanyName.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtCompanyNameKeyTyped(evt);
            }
        });

        btnRefreshCompanyList.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Refresh.png"))); // NOI18N
        btnRefreshCompanyList.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRefreshCompanyListActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlCompanyLayout = new javax.swing.GroupLayout(pnlCompany);
        pnlCompany.setLayout(pnlCompanyLayout);
        pnlCompanyLayout.setHorizontalGroup(
            pnlCompanyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlCompanyLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlCompanyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addGroup(pnlCompanyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(lblCompanyList)
                        .addGroup(pnlCompanyLayout.createSequentialGroup()
                            .addComponent(btnRefreshCompanyList)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(btnInsertCompany)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(btnUpdateCompany)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(btnDeleteCompany)))
                    .addComponent(txtCompanyName))
                .addGap(0, 18, 18)
                .addGroup(pnlCompanyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlCompanyLayout.createSequentialGroup()
                        .addComponent(radioCloseCompany)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(radioOpenCompany)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 5, Short.MAX_VALUE)
                        .addComponent(btnAddCandidate2Company))
                    .addGroup(pnlCompanyLayout.createSequentialGroup()
                        .addGroup(pnlCompanyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblCloseSysCandidate)
                            .addComponent(lblOpenSysCandidate)
                            .addComponent(lblInsertCandidate))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(cbCandidate, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING))
                .addContainerGap())
        );
        pnlCompanyLayout.setVerticalGroup(
            pnlCompanyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlCompanyLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlCompanyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCompanyList)
                    .addComponent(lblInsertCandidate))
                .addGap(5, 5, 5)
                .addGroup(pnlCompanyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbCandidate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtCompanyName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlCompanyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlCompanyLayout.createSequentialGroup()
                        .addComponent(jScrollPane4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlCompanyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnRefreshCompanyList, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(pnlCompanyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(btnInsertCompany)
                                .addComponent(btnUpdateCompany)
                                .addComponent(btnDeleteCompany))))
                    .addGroup(pnlCompanyLayout.createSequentialGroup()
                        .addGroup(pnlCompanyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(radioCloseCompany)
                            .addComponent(radioOpenCompany)
                            .addComponent(btnAddCandidate2Company))
                        .addGap(18, 18, 18)
                        .addComponent(lblCloseSysCandidate)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblOpenSysCandidate)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(28, Short.MAX_VALUE))))
        );

        pnlContainer.add(pnlCompany, "card2");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnlContainer, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btnCandidate)
                        .addGap(18, 18, 18)
                        .addComponent(btnCompany)
                        .addGap(18, 18, 18)
                        .addComponent(btnInterview)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnLogout)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnCandidate)
                    .addComponent(btnCompany)
                    .addComponent(btnInterview)
                    .addComponent(btnLogout))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnlContainer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLogoutActionPerformed
        // Disconnect and back to login screen
        if (Frm_Monitor.myMonitor!=null) {
            Frm_Monitor.setRunningThread(false);
            Frm_Monitor.myMonitor.setVisible(false);
        }
        PostGre_func.getInstance().disconnect();
        CareerDay_Frame.main(null);
        this.setVisible(false);
    }//GEN-LAST:event_btnLogoutActionPerformed
    
    private void btnCandidateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCandidateActionPerformed
        // shows pnlCandidate as first layer
        CardLayout myLayout = (CardLayout) pnlContainer.getLayout();
        myLayout.first(pnlContainer);
        myLayout.next(pnlContainer);
        
        refreshCandidateScreen();
    }//GEN-LAST:event_btnCandidateActionPerformed

    private void btnCompanyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCompanyActionPerformed
        // shows pnlCompany as First layer
        CardLayout myLayout = (CardLayout) pnlContainer.getLayout();
        myLayout.last(pnlContainer);
        
        refreshCompanyScreen();
    }//GEN-LAST:event_btnCompanyActionPerformed

    private void btnInterviewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInterviewActionPerformed
        // shows pnlInterview as first layer
        CardLayout myLayout = (CardLayout) pnlContainer.getLayout();
        myLayout.first(pnlContainer);
        refreshInterviewScreen();
        
        //show information monitor
        Frm_Monitor.main(null);
    }//GEN-LAST:event_btnInterviewActionPerformed

    private void btnInsertCompanyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInsertCompanyActionPerformed
        // Insert and link all candidate list in Interview Table
        PostGre_func.getInstance().saveCompany(txtCompanyName.getText().trim());
        
        DefaultListModel closeModel = (DefaultListModel) listCloseSysCandidate.getModel();
        String companyID = PostGre_func.getInstance().getCompanyID(txtCompanyName.getText());
        for (int i=0; i<closeModel.getSize();i++) {
            String value = (String) closeModel.get(i);
            if (value.charAt(0)=='*')
                value = value.substring(1);
            value = PostGre_func.getInstance().getCandidateID(value);
            PostGre_func.getInstance().saveInterview(value, companyID, true);
        }
        
        DefaultListModel openModel = (DefaultListModel) listOpenSysCandidate.getModel();
        for (int i=0; i<openModel.getSize();i++) {
            String value = (String) openModel.get(i);
            if (value.charAt(0)=='*')
                value = value.substring(1);
            value = PostGre_func.getInstance().getCandidateID(value);
            PostGre_func.getInstance().saveInterview(value, companyID, false);
        }

        refreshCompanyScreen();
    }//GEN-LAST:event_btnInsertCompanyActionPerformed

    private void btnAddCompany2CandidateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddCompany2CandidateActionPerformed
        // Insert company in listbox (closed/open)
        if (cbCompany.getSelectedIndex()>=0) {
            if(radioCloseCandidate.isSelected()) {
                DefaultListModel closeModel = (DefaultListModel) listCloseSysCompany.getModel();
                closeModel.add(closeModel.getSize(), "*"+(String) cbCompany.getSelectedItem());
                cbCompany.removeItemAt(cbCompany.getSelectedIndex());
            } else {
                DefaultListModel openModel = (DefaultListModel) listOpenSysCompany.getModel();
                openModel.add(openModel.getSize(), "*"+(String) cbCompany.getSelectedItem());
                cbCompany.removeItemAt(cbCompany.getSelectedIndex());
            }
        } else {
            javax.swing.JOptionPane.showMessageDialog(this, "Please select company first");
        }
    }//GEN-LAST:event_btnAddCompany2CandidateActionPerformed

    private void btnCheckIn4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckIn4ActionPerformed
        PostGre_func.getInstance().checkinInterview((String)cbCandidate4CheckIn.getSelectedItem(), (String)cbCompanyCheckin.getSelectedItem()+4);
        lblStatusCheckin.setText("Status : Candidate " + (String)cbCandidate4CheckIn.getSelectedItem() + " checking in");
        cbCompanyCheckinActionPerformed(evt);
        cbCandidateCheckoutActionPerformed(evt);
    }//GEN-LAST:event_btnCheckIn4ActionPerformed

    private void btnAddCandidate2CompanyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddCandidate2CompanyActionPerformed
        // Insert candidate in listbox (closed/open)
        if (cbCandidate.getSelectedIndex()>=0) {
            if (radioCloseCompany.isSelected()) {
                DefaultListModel closeModel = (DefaultListModel) listCloseSysCandidate.getModel();
                closeModel.add(closeModel.getSize(), "*"+(String) cbCandidate.getSelectedItem());
                cbCandidate.removeItemAt(cbCandidate.getSelectedIndex());
            } else {
                DefaultListModel openModel = (DefaultListModel) listOpenSysCandidate.getModel();
                openModel.add(openModel.getSize(), "*"+(String) cbCandidate.getSelectedItem());            
                cbCandidate.removeItemAt(cbCandidate.getSelectedIndex());
            }
        } else {
            javax.swing.JOptionPane.showMessageDialog(this, "Please select candidate first");
        }
    }//GEN-LAST:event_btnAddCandidate2CompanyActionPerformed

    private void btnInsertCandidateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInsertCandidateActionPerformed
        // Insert Candidate and link all company in Interview table
        PostGre_func.getInstance().saveCandidate(txtCandidateName.getText().trim());
        
        DefaultListModel closeModel = (DefaultListModel) listCloseSysCompany.getModel();
        String candidateID = PostGre_func.getInstance().getCandidateID(txtCandidateName.getText());
        for (int i=0; i<closeModel.getSize();i++) {
            String value = (String) closeModel.get(i);
            if (value.charAt(0)=='*')
                value = value.substring(1);
            value = PostGre_func.getInstance().getCompanyID(value);
            PostGre_func.getInstance().saveInterview(candidateID, value, true);
        }
        
        DefaultListModel openModel = (DefaultListModel) listOpenSysCompany.getModel();
        for (int i=0; i<openModel.getSize();i++) {
            String value = (String) openModel.get(i);
            if (value.charAt(0)=='*')
                value = value.substring(1);
            value = PostGre_func.getInstance().getCompanyID(value);
            PostGre_func.getInstance().saveInterview(candidateID, value, false);
        }

        refreshCandidateScreen();
    }//GEN-LAST:event_btnInsertCandidateActionPerformed

    // an array that will commit all removed company
    List <String> removedCompanyID = new ArrayList<>();
    private void menuRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuRemoveActionPerformed
        // Delete selected company in candidate panel
        //removedCompanyID.clear();

        if (listCloseSysCompany.getSelectedIndex()>=0) {
            String companyName = (String) listCloseSysCompany.getSelectedValue();
            if (!companyName.substring(companyName.length()-5, companyName.length()-1).equals("DONE")) {
                int response = javax.swing.JOptionPane.showConfirmDialog(this, "Are You sure?", "Delete " + companyName, JOptionPane.YES_NO_OPTION);
                if (response==javax.swing.JOptionPane.YES_OPTION) {
                    ((DefaultListModel) listCloseSysCompany.getModel()).remove(listCloseSysCompany.getSelectedIndex());
                    removedCompanyID.add(PostGre_func.getInstance().getCompanyID(companyName));
                }
            }
        }
        
        if (listOpenSysCompany.getSelectedIndex()>=0) {
            String companyName = (String) listOpenSysCompany.getSelectedValue();
            if (!companyName.substring(companyName.length()-5, companyName.length()-1).equals("DONE")) {
                int response = javax.swing.JOptionPane.showConfirmDialog(this, "Are You sure?", "Delete " + companyName, JOptionPane.YES_NO_OPTION);
                if (response==javax.swing.JOptionPane.YES_OPTION) {
                    ((DefaultListModel) listOpenSysCompany.getModel()).remove(listOpenSysCompany.getSelectedIndex());            
                    removedCompanyID.add(PostGre_func.getInstance().getCompanyID(companyName));            
                }
            }
        }
    }//GEN-LAST:event_menuRemoveActionPerformed

    private void btnDeleteCandidateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteCandidateActionPerformed
        // delete candidate
        DefaultTableModel candidateModel = (DefaultTableModel) tblCandidate.getModel();
        String candidateName = (String) candidateModel.getValueAt(tblCandidate.getSelectedRow(), 0);
        //warn user to delete particular candidate
        int response = javax.swing.JOptionPane.showConfirmDialog(this, "Are You sure?", "Delete " + candidateName, JOptionPane.YES_NO_OPTION);
        if (response==javax.swing.JOptionPane.YES_OPTION) {
            PostGre_func.getInstance().deleteCandidate(candidateName);
            refreshCandidateScreen();
        }
    }//GEN-LAST:event_btnDeleteCandidateActionPerformed

    static List<String> insertedCompany = new ArrayList<>();
    private void tblCandidateMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblCandidateMouseReleased
        // shows all candidate information
        if (evt.getButton()==MouseEvent.BUTTON1) {
            DefaultTableModel candidateModel = (DefaultTableModel) tblCandidate.getModel();
            String candidateName = (String) candidateModel.getValueAt(tblCandidate.getSelectedRow(), 0);
            txtCandidateName.setText(candidateName);
            
            // shows all linked company in the list box
            List<String> closedCompany = new ArrayList<>(),
                    openCompany = new ArrayList<>();;
            ResultSet myRS = PostGre_func.getInstance().getCompanyFromInterview(candidateName);
            try {
                insertedCompany.clear();
                while (myRS.next()) {
                    String isDone = "";
                    if (myRS.getBoolean(3))
                        isDone = " [DONE]";
                    if (myRS.getBoolean(2)) {
                        closedCompany.add(myRS.getString(1)+isDone);
                    } else {
                        openCompany.add(myRS.getString(1)+isDone);
                    }
                    insertedCompany.add(myRS.getString(1));
                }
                
                Object[] myList = closedCompany.toArray();
                Arrays.sort(myList);
                ((DefaultListModel) listCloseSysCompany.getModel()).clear();
                for (int i=0;i<myList.length;i++)
                    ((DefaultListModel) listCloseSysCompany.getModel()).add(i,myList[i]);
                
                myList = openCompany.toArray();
                Arrays.sort(myList);
                ((DefaultListModel) listOpenSysCompany.getModel()).clear();
                for (int i=0;i<myList.length;i++)
                    ((DefaultListModel) listOpenSysCompany.getModel()).add(i,myList[i]);
                
                cbCompany.removeAllItems();
                ResultSet mySet = PostGre_func.getInstance().getCompany();
                List<String> companyList = new ArrayList<>();
                while (mySet.next())
                    if (!insertedCompany.contains(mySet.getString(2)))
                        companyList.add(mySet.getString(2));
                Object[] list = companyList.toArray();
                for (int i=0;i<list.length;i++)
                    cbCompany.addItem(list[i]);

            } catch (SQLException ex) {
                java.util.logging.Logger.getLogger("pmbs.CareerDay").log(java.util.logging.Level.SEVERE, null, ex);                
            }  
            
            btnInsertCandidate.setEnabled(false);
            btnUpdateCandidate.setEnabled(true);
            btnDeleteCandidate.setEnabled(true);
        }
    }//GEN-LAST:event_tblCandidateMouseReleased

    private void btnUpdateCandidateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateCandidateActionPerformed
        // Save added company
        String candidateID = PostGre_func.getInstance().getCandidateID(txtCandidateName.getText());

        //commit removed company
        Iterator<String> CompanyID = removedCompanyID.iterator();
        while (CompanyID.hasNext()) {
            PostGre_func.getInstance().deleteCompanyfromInterview(candidateID, CompanyID.next());
        }
        removedCompanyID.clear();
        
        DefaultListModel closeModel = (DefaultListModel) listCloseSysCompany.getModel();
        for (int i=0; i<closeModel.getSize();i++) {
            String value = (String) closeModel.get(i);
            if (value.charAt(0)=='*') {
                value = value.substring(1);
                value = PostGre_func.getInstance().getCompanyID(value);
                PostGre_func.getInstance().saveInterview(candidateID, value, true);
            }
        }
        
        DefaultListModel openModel = (DefaultListModel) listOpenSysCompany.getModel();
        for (int i=0; i<openModel.getSize();i++) {
            String value = (String) openModel.get(i);
            if (value.charAt(0)=='*') {
                value = value.substring(1);
                value = PostGre_func.getInstance().getCompanyID(value);
                PostGre_func.getInstance().saveInterview(candidateID, value, false);
            }
        }
        
        refreshCandidateScreen();
    }//GEN-LAST:event_btnUpdateCandidateActionPerformed

    List<String> removedCandidateID = new ArrayList<>();
    private void menuRemove2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuRemove2ActionPerformed
        // Delete selected candidate in company panel
        //removedCandidateID.clear();
        
        if (listCloseSysCandidate.getSelectedIndex()>=0) {
            String candidateName = (String) listCloseSysCandidate.getSelectedValue();
            if (!candidateName.substring(candidateName.length()-5, candidateName.length()-1).equals("DONE")) {
                int response = javax.swing.JOptionPane.showConfirmDialog(this, "Are You sure?", "Delete " + candidateName, JOptionPane.YES_NO_OPTION);
                if (response==javax.swing.JOptionPane.YES_OPTION) {
                    ((DefaultListModel) listCloseSysCandidate.getModel()).remove(listCloseSysCandidate.getSelectedIndex());
                    removedCandidateID.add(PostGre_func.getInstance().getCandidateID(candidateName));
                }
            }
        }
        
        if (listOpenSysCandidate.getSelectedIndex()>=0) {
            String candidateName = (String) listOpenSysCandidate.getSelectedValue();
            if (!candidateName.substring(candidateName.length()-5, candidateName.length()-1).equals("DONE")) {
                int response = javax.swing.JOptionPane.showConfirmDialog(this, "Are You sure?", "Delete " + candidateName, JOptionPane.YES_NO_OPTION);
                if (response==javax.swing.JOptionPane.YES_OPTION) {
                    ((DefaultListModel) listOpenSysCandidate.getModel()).remove(listOpenSysCandidate.getSelectedIndex());            
                    removedCandidateID.add(PostGre_func.getInstance().getCandidateID(candidateName));            
                }
            }
        }
    }//GEN-LAST:event_menuRemove2ActionPerformed

    private void btnUpdateCompanyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateCompanyActionPerformed
        // Save added candidate
        String companyID = PostGre_func.getInstance().getCompanyID(txtCompanyName.getText());
        
        //commit removed candidate
        Iterator<String> CandidateID = removedCandidateID.iterator();
        while (CandidateID.hasNext()) {
            PostGre_func.getInstance().deleteCompanyfromInterview(CandidateID.next(),companyID);
        }
        removedCandidateID.clear();

        
        DefaultListModel closeModel = (DefaultListModel) listCloseSysCandidate.getModel();
        for (int i=0; i<closeModel.getSize();i++) {
            String value = (String) closeModel.get(i);
            if (value.charAt(0)=='*') {
                value = value.substring(1);
                value = PostGre_func.getInstance().getCandidateID(value);
                PostGre_func.getInstance().saveInterview(value, companyID,  true);
            }
        }
        
        DefaultListModel openModel = (DefaultListModel) listOpenSysCandidate.getModel();
        for (int i=0; i<openModel.getSize();i++) {
            String value = (String) openModel.get(i);
            if (value.charAt(0)=='*') {
                value = value.substring(1);
                value = PostGre_func.getInstance().getCandidateID(value);
                PostGre_func.getInstance().saveInterview(value, companyID,  false);
            }
        }
                
        refreshCompanyScreen();

    }//GEN-LAST:event_btnUpdateCompanyActionPerformed

    private void btnDeleteCompanyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteCompanyActionPerformed
        // delete candidate
        DefaultTableModel companyModel = (DefaultTableModel) tblCompany.getModel();
        String companyName = (String) companyModel.getValueAt(tblCompany.getSelectedRow(), 0);
        
        //warn user to delete particular candidate
        int response = javax.swing.JOptionPane.showConfirmDialog(this, "Are You sure?", "Delete " + companyName, JOptionPane.YES_NO_OPTION);
        if (response==javax.swing.JOptionPane.YES_OPTION) {
            PostGre_func.getInstance().deleteCompany(companyName);
            refreshCompanyScreen();        
        }
    }//GEN-LAST:event_btnDeleteCompanyActionPerformed

    static List<String> insertedCandidate = new ArrayList<>();
    private void tblCompanyMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblCompanyMouseReleased
        // shows all company information
        if (evt.getButton()==MouseEvent.BUTTON1) {
            DefaultTableModel companyModel = (DefaultTableModel) tblCompany.getModel();
            String companyName = (String) companyModel.getValueAt(tblCompany.getSelectedRow(), 0);
            txtCompanyName.setText(companyName);
            
            // shows all linked company in the list box
            List<String> closedCandidate = new ArrayList<>(),
                    openCandidate = new ArrayList<>();;
            ResultSet myRS = PostGre_func.getInstance().getCandidateFromInterview(companyName);
            try {
                insertedCandidate.clear();
                while (myRS.next()) {
                    String isDone = "";
                    if (myRS.getBoolean(3))
                        isDone = " [DONE]";
                    if (myRS.getBoolean(2)) {
                        closedCandidate.add(myRS.getString(1)+isDone);
                    } else {
                        openCandidate.add(myRS.getString(1)+isDone);
                    }
                    insertedCandidate.add(myRS.getString(1));
                }
                
                Object[] myList = closedCandidate.toArray();
                Arrays.sort(myList);
                ((DefaultListModel) listCloseSysCandidate.getModel()).clear();
                for (int i=0;i<myList.length;i++) {
                    ((DefaultListModel) listCloseSysCandidate.getModel()).add(i,myList[i]);
                }
                
                myList = openCandidate.toArray();
                Arrays.sort(myList);
                ((DefaultListModel) listOpenSysCandidate.getModel()).clear();
                for (int i=0;i<myList.length;i++) {
                    ((DefaultListModel) listOpenSysCandidate.getModel()).add(i,myList[i]);
                }
                
                cbCandidate.removeAllItems();
                ResultSet mySet = PostGre_func.getInstance().getCandidate();
                List<String> candidateList = new ArrayList<>();
                while (mySet.next())
                    if (!insertedCandidate.contains(mySet.getString(2)))
                        candidateList.add(mySet.getString(2));
                Object[] list = candidateList.toArray();
                for (int i=0;i<list.length;i++)
                    cbCandidate.addItem(list[i]);   
                
            } catch (SQLException ex) {
                java.util.logging.Logger.getLogger("pmbs.CareerDay").log(java.util.logging.Level.SEVERE, null, ex);                
            }
            
            btnInsertCompany.setEnabled(false);
            btnUpdateCompany.setEnabled(true);
            btnDeleteCompany.setEnabled(true);
        }
    }//GEN-LAST:event_tblCompanyMouseReleased

    private void txtCandidateNameKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCandidateNameKeyTyped
        // disable all button but insert
        btnInsertCandidate.setEnabled(true);
        btnUpdateCandidate.setEnabled(false);
        btnDeleteCandidate.setEnabled(false);
    }//GEN-LAST:event_txtCandidateNameKeyTyped

    private void txtCompanyNameKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCompanyNameKeyTyped
        // disable all button but insert
        btnInsertCompany.setEnabled(true);
        btnUpdateCompany.setEnabled(false);
        btnDeleteCompany.setEnabled(false);
    }//GEN-LAST:event_txtCompanyNameKeyTyped

    private void listCloseSysCompanyFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_listCloseSysCompanyFocusGained
        // clear selected index from another box
        listOpenSysCompany.getSelectionModel().clearSelection();
    }//GEN-LAST:event_listCloseSysCompanyFocusGained

    private void listOpenSysCompanyFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_listOpenSysCompanyFocusGained
        // clear selected index from another box
        listCloseSysCompany.getSelectionModel().clearSelection();
    }//GEN-LAST:event_listOpenSysCompanyFocusGained

    private void listCloseSysCandidateFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_listCloseSysCandidateFocusGained
        // clear selected index from another box
        listOpenSysCandidate.getSelectionModel().clearSelection();
    }//GEN-LAST:event_listCloseSysCandidateFocusGained

    private void listOpenSysCandidateFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_listOpenSysCandidateFocusGained
        // clear selected index from another box
        listCloseSysCandidate.getSelectionModel().clearSelection();
    }//GEN-LAST:event_listOpenSysCandidateFocusGained

    private void cbCompanyCheckinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbCompanyCheckinActionPerformed
        // when user select the company, all available candidate must be accessible in the candidate combo box
        String companyName = (String)cbCompanyCheckin.getSelectedItem();
        
        if (cbCompanyCheckin.getSelectedItem() != null) { 
            //disable all choice first
            cbCandidate1Checkin.setEnabled(false);
            cbCandidate2Checkin.setEnabled(false);
            cbCandidate3CheckIn.setEnabled(false);
            cbCandidate4CheckIn.setEnabled(false);
            cbCandidate5CheckIn.setEnabled(false);
            cbCandidate6CheckIn.setEnabled(false);
            cbCandidate1Checkin.removeAllItems();
            cbCandidate2Checkin.removeAllItems();
            cbCandidate3CheckIn.removeAllItems();
            cbCandidate4CheckIn.removeAllItems();
            cbCandidate5CheckIn.removeAllItems();
            cbCandidate6CheckIn.removeAllItems();
            btnCheckin1.setEnabled(false);
            btnCheckIn2.setEnabled(false);
            btnCheckIn3.setEnabled(false);
            btnCheckIn4.setEnabled(false);
            btnCheckIn5.setEnabled(false);
            btnCheckIn6.setEnabled(false);
            
            // determine whether the company is present or not
            if (PostGre_func.getInstance().isCompanyPresent(companyName)) {
                ResultSet mySet = PostGre_func.getInstance().getCandidateFromInterview(companyName);
                // filter myset to present, not done, and idle candidate
                List<String> availableCandidate = new ArrayList<>();
                try {
                    while (mySet.next()) {
                        boolean isDone = mySet.getBoolean(3),
                                isOccupied = mySet.getBoolean(4), 
                                isPresent = mySet.getBoolean(5);
                        if (!isDone && !isOccupied && isPresent)
                            availableCandidate.add(mySet.getString(1));
                    }
                } catch (SQLException ex) {
                    java.util.logging.Logger.getLogger("pmbs.CareerDay").log(java.util.logging.Level.SEVERE, null, ex);            
                }

                byte interviewerCount = PostGre_func.getInstance().getInterviewerCount(companyName);
                spinInterviewerCount.setValue(interviewerCount);
                if (interviewerCount>=1) {
                    if (fillCheckInCB(cbCandidate1Checkin, availableCandidate, companyName+1)) {
                        btnCheckin1.setEnabled(false);                        
                    } else {
                        btnCheckin1.setEnabled(true);
                    }
                }
                if (interviewerCount>=2) {
                    if (fillCheckInCB(cbCandidate2Checkin, availableCandidate, companyName+2)) {
                        btnCheckIn2.setEnabled(false);                        
                    } else {
                        btnCheckIn2.setEnabled(true);
                    }
                }
                if (interviewerCount>=3) {
                    if (fillCheckInCB(cbCandidate3CheckIn, availableCandidate, companyName+3)) {
                        btnCheckIn3.setEnabled(false);                        
                    } else {
                        btnCheckIn3.setEnabled(true);
                    }
                }
                if (interviewerCount>=4) {
                    if (fillCheckInCB(cbCandidate4CheckIn, availableCandidate, companyName+4)) {
                        btnCheckIn4.setEnabled(false);                        
                    } else {
                        btnCheckIn4.setEnabled(true);
                    }
                }
                if (interviewerCount>=5) {
                    if (fillCheckInCB(cbCandidate5CheckIn, availableCandidate, companyName+4)) {
                        btnCheckIn5.setEnabled(false);                        
                    } else {
                        btnCheckIn5.setEnabled(true);
                    }
                }
                if (interviewerCount>=6) {
                    if (fillCheckInCB(cbCandidate6CheckIn, availableCandidate, companyName+4)) {
                        btnCheckIn6.setEnabled(false);                        
                    } else {
                        btnCheckIn6.setEnabled(true);
                    }
                }
                tbtnCompanyPresent.setEnabled(false);
                btnInterviewerUpdate.setEnabled(true);
                //spinInterviewerCount.setEnabled(false);
                //cbRoom.setEnabled(false);

            } else {
                tbtnCompanyPresent.setEnabled(true);
                btnInterviewerUpdate.setEnabled(false);
                //spinInterviewerCount.setEnabled(true);
                //cbRoom.setEnabled(true);
                tbtnCompanyPresent.setSelected(false);      
                
            }
        }
    }//GEN-LAST:event_cbCompanyCheckinActionPerformed

    private void tbtnCompanyPresentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbtnCompanyPresentActionPerformed
        // insert interviewer and name based on companyName+#number
        if (cbRoom.getModel().getSelectedItem()!=null) {
            if (cbCompanyCheckin.getSelectedItem()!=null) {
                PostGre_func.getInstance().saveInterviewer((String)cbCompanyCheckin.getSelectedItem(), 
                        (byte) spinInterviewerCount.getValue(), 
                        (String)cbRoom.getSelectedItem());
            }
            
            //simply populate the combobox with existing room
            fillInterviewRoom();
            
            tbtnCompanyPresent.setEnabled(false);
            //cbRoom.setEnabled(false);
            //spinInterviewerCount.setEnabled(false);
            lblStatusCheckin.setText("Status : " + cbCompanyCheckin.getModel().getSelectedItem() + " is present");
            cbCompanyCheckinActionPerformed(evt);
        }
    }//GEN-LAST:event_tbtnCompanyPresentActionPerformed

    private void cbCandidateCheckoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbCandidateCheckoutActionPerformed
        // check whether the candidate is present or not
        if (!PostGre_func.getInstance().isCandidatePresent((String) cbCandidateCheckout.getSelectedItem())) {
            tbtnCandidatePresent.setEnabled(true);
            tbtnCandidatePresent.setSelected(false);
            btnIdle.setEnabled(false);
            btnOccupied.setEnabled(false);
        } else {
            tbtnCandidatePresent.setEnabled(false);
        
            // is occupied or not
            if (PostGre_func.getInstance().isCandidateOccupied((String) cbCandidateCheckout.getSelectedItem())) {
                btnIdle.setEnabled(true);
                btnOccupied.setEnabled(false);
            } else {
                btnIdle.setEnabled(false);
                btnOccupied.setEnabled(true);            
            }
        }

    }//GEN-LAST:event_cbCandidateCheckoutActionPerformed

    private void tbtnCandidatePresentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbtnCandidatePresentActionPerformed
        // set present to selected candidate
        if (cbCandidateCheckout.getSelectedItem()!=null) {
            PostGre_func.getInstance().setCandidatePresent((String)cbCandidateCheckout.getSelectedItem());
            btnIdle.setEnabled(false);
            btnOccupied.setEnabled(true);
            tbtnCandidatePresent.setEnabled(false);
            lblStatusCheckout.setText("Status : Candidate " + (String)cbCandidateCheckout.getSelectedItem() + " is present");
        }
    }//GEN-LAST:event_tbtnCandidatePresentActionPerformed

    private void btnOccupiedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOccupiedActionPerformed
        // set selected candidate to occupied
        if (cbCandidateCheckout.getSelectedItem()!=null) {
            PostGre_func.getInstance().setCandidateOccupied((String)cbCandidateCheckout.getSelectedItem());
            btnIdle.setEnabled(true);
            btnOccupied.setEnabled(false);                    
            cbCompanyCheckinActionPerformed(evt);        
            lblStatusCheckout.setText("Status : Candidate " + (String)cbCandidateCheckout.getSelectedItem() + " is busy");        
        }    
    }//GEN-LAST:event_btnOccupiedActionPerformed

    private void btnIdleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIdleActionPerformed
        //let the postgre checkout function do all the work
        if (cbCandidateCheckout.getSelectedItem()!=null) {
            PostGre_func.getInstance().checkoutCandidate((String)cbCandidateCheckout.getSelectedItem());
            btnIdle.setEnabled(false);
            btnOccupied.setEnabled(true);                    
            cbCompanyCheckinActionPerformed(evt);        
            lblStatusCheckout.setText("Status : Candidate " + (String)cbCandidateCheckout.getSelectedItem() + " is idle");        
        }        
    }//GEN-LAST:event_btnIdleActionPerformed

    private void btnCheckin1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckin1ActionPerformed
        PostGre_func.getInstance().checkinInterview((String)cbCandidate1Checkin.getSelectedItem(), (String)cbCompanyCheckin.getSelectedItem()+1);
        lblStatusCheckin.setText("Status : Candidate " + (String)cbCandidate1Checkin.getSelectedItem() + " checking in");
        cbCompanyCheckinActionPerformed(evt);
        cbCandidateCheckoutActionPerformed(evt);
    }//GEN-LAST:event_btnCheckin1ActionPerformed

    private void btnCheckIn2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckIn2ActionPerformed
        PostGre_func.getInstance().checkinInterview((String)cbCandidate2Checkin.getSelectedItem(), (String)cbCompanyCheckin.getSelectedItem()+2);
        lblStatusCheckin.setText("Status : Candidate " + (String)cbCandidate2Checkin.getSelectedItem() + " checking in");
        cbCompanyCheckinActionPerformed(evt);
        cbCandidateCheckoutActionPerformed(evt);
    }//GEN-LAST:event_btnCheckIn2ActionPerformed

    private void btnCheckIn3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckIn3ActionPerformed
        PostGre_func.getInstance().checkinInterview((String)cbCandidate3CheckIn.getSelectedItem(), (String)cbCompanyCheckin.getSelectedItem()+3);
        lblStatusCheckin.setText("Status : Candidate " + (String)cbCandidate3CheckIn.getSelectedItem() + " checking in");
        cbCompanyCheckinActionPerformed(evt);
        cbCandidateCheckoutActionPerformed(evt);
    }//GEN-LAST:event_btnCheckIn3ActionPerformed

    private void cbCompanyKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cbCompanyKeyReleased
        // If user pressed enter key, the data will be inserted
        if (evt.getKeyCode()==java.awt.event.KeyEvent.VK_ENTER)
            btnAddCompany2CandidateActionPerformed(null);
    }//GEN-LAST:event_cbCompanyKeyReleased

    private void pnlCompanyKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_pnlCompanyKeyReleased
        // If user pressed enter key, the data will be inserted
        if (evt.getKeyCode()==java.awt.event.KeyEvent.VK_ENTER)
            btnAddCandidate2CompanyActionPerformed(null);
    }//GEN-LAST:event_pnlCompanyKeyReleased

    private void menuToggleDoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuToggleDoneActionPerformed
        //Undone selected company
        if (listCloseSysCompany.getSelectedIndex()>=0) {
            String companyName = (String) listCloseSysCompany.getSelectedValue();
            if (companyName.substring(companyName.length()-5, companyName.length()-1).equals("DONE")) {
                DefaultListModel companyListModel = (DefaultListModel) listCloseSysCompany.getModel();
                companyName = companyName.substring(0, companyName.length()-7);
                companyListModel.set(listCloseSysCompany.getSelectedIndex(), companyName);
                PostGre_func.getInstance().toggleDone(txtCandidateName.getText(), companyName);
            }
        }
        
        if (listOpenSysCompany.getSelectedIndex()>=0) {
            String companyName = (String) listOpenSysCompany.getSelectedValue();
            if (companyName.substring(companyName.length()-5, companyName.length()-1).equals("DONE")) {
                DefaultListModel companyListModel = (DefaultListModel) listOpenSysCompany.getModel();
                companyName = companyName.substring(0, companyName.length()-7);
                companyListModel.set(listOpenSysCompany.getSelectedIndex(), companyName);
                PostGre_func.getInstance().toggleDone(txtCandidateName.getText(), companyName);
            }
        }
    }//GEN-LAST:event_menuToggleDoneActionPerformed

    private void menuToggleDone2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuToggleDone2ActionPerformed
        // undone selected candidate
        if (listCloseSysCandidate.getSelectedIndex()>=0) {
            String candidateName = (String) listCloseSysCandidate.getSelectedValue();
            if (candidateName.substring(candidateName.length()-5, candidateName.length()-1).equals("DONE")) {
                DefaultListModel candidateListModel = (DefaultListModel) listCloseSysCandidate.getModel();
                candidateName = candidateName.substring(0,candidateName.length()-7);
                candidateListModel.set(listCloseSysCandidate.getSelectedIndex(), candidateName);
                PostGre_func.getInstance().toggleDone(candidateName, txtCompanyName.getText());
            }
        }
        
        if (listOpenSysCandidate.getSelectedIndex()>=0) {
            String candidateName = (String) listOpenSysCandidate.getSelectedValue();
            if (candidateName.substring(candidateName.length()-5, candidateName.length()-1).equals("DONE")) {
                DefaultListModel candidateListModel = (DefaultListModel) listOpenSysCandidate.getModel();
                candidateName = candidateName.substring(0,candidateName.length()-7);
                candidateListModel.set(listOpenSysCandidate.getSelectedIndex(), candidateName);
                PostGre_func.getInstance().toggleDone(candidateName, txtCompanyName.getText());
            }
        }

    }//GEN-LAST:event_menuToggleDone2ActionPerformed

    private void btnRefreshCompanyListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshCompanyListActionPerformed
        // Just Refresh the List
        refreshCompanyScreen();
    }//GEN-LAST:event_btnRefreshCompanyListActionPerformed

    private void btnRefreshCandidateListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshCandidateListActionPerformed
        // Just Refresh the List
        refreshCandidateScreen();
    }//GEN-LAST:event_btnRefreshCandidateListActionPerformed

    private void btnCheckIn5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckIn5ActionPerformed
        PostGre_func.getInstance().checkinInterview((String)cbCandidate5CheckIn.getSelectedItem(), (String)cbCompanyCheckin.getSelectedItem()+5);
        lblStatusCheckin.setText("Status : Candidate " + (String)cbCandidate5CheckIn.getSelectedItem() + " checking in");
        cbCompanyCheckinActionPerformed(evt);
        cbCandidateCheckoutActionPerformed(evt);
    }//GEN-LAST:event_btnCheckIn5ActionPerformed

    private void btnCheckIn6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckIn6ActionPerformed
        PostGre_func.getInstance().checkinInterview((String)cbCandidate6CheckIn.getSelectedItem(), (String)cbCompanyCheckin.getSelectedItem()+6);
        lblStatusCheckin.setText("Status : Candidate " + (String)cbCandidate6CheckIn.getSelectedItem() + " checking in");
        cbCompanyCheckinActionPerformed(evt);
        cbCandidateCheckoutActionPerformed(evt);
    }//GEN-LAST:event_btnCheckIn6ActionPerformed

    private void btnInterviewerUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInterviewerUpdateActionPerformed
        // update number of interviewer that company has
        String companyName = (String)cbCompanyCheckin.getSelectedItem();
        PostGre_func.getInstance().updateInterviewerNumber(PostGre_func.getInstance().getInterviewerCount(companyName),
                (int) spinInterviewerCount.getValue(),companyName,(String)cbRoom.getSelectedItem());
        
        lblStatusCheckin.setText("Status : " + cbCompanyCheckin.getModel().getSelectedItem() + " Interviewer is updated");
        
        refreshInterviewScreen();
    }//GEN-LAST:event_btnInterviewerUpdateActionPerformed
    
    private boolean fillCheckInCB (JComboBox mycb, List<String> candidateList, String interviewerName) {
        mycb.removeAllItems();
        if (PostGre_func.getInstance().isInterviewerOccupied(interviewerName)) {
            mycb.setEditable(true);
            mycb.setSelectedItem(PostGre_func.getInstance().getCandidateFromInterviewer(interviewerName));
            mycb.setEnabled(false);
            return true;
        } else {
            mycb.setEnabled(true);
            Iterator iterate = candidateList.iterator();
            while (iterate.hasNext()) {
                mycb.addItem(iterate.next());
            }
            mycb.setEditable(false);
            return false;
        }
    }
    
    /**
     * @param args the command line arguments
     */
    static frmMain cd;
    public static void main(String args[]) {

        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger("pmbs.CareerDay").log(java.util.logging.Level.SEVERE, null, ex);
        }

        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                if (cd==null)
                    cd = new frmMain();
                cd.setLocationRelativeTo(null);
                cd.setVisible(true);
            }
        });
        
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAddCandidate2Company;
    private javax.swing.JButton btnAddCompany2Candidate;
    private javax.swing.JButton btnCandidate;
    private javax.swing.JButton btnCheckIn2;
    private javax.swing.JButton btnCheckIn3;
    private javax.swing.JButton btnCheckIn4;
    private javax.swing.JButton btnCheckIn5;
    private javax.swing.JButton btnCheckIn6;
    private javax.swing.JButton btnCheckin1;
    private javax.swing.JButton btnCompany;
    private javax.swing.JButton btnDeleteCandidate;
    private javax.swing.JButton btnDeleteCompany;
    private javax.swing.ButtonGroup btnGroupCandidate;
    private javax.swing.ButtonGroup btnGroupCompany;
    private javax.swing.JButton btnIdle;
    private javax.swing.JButton btnInsertCandidate;
    private javax.swing.JButton btnInsertCompany;
    private javax.swing.JButton btnInterview;
    private javax.swing.JButton btnInterviewerUpdate;
    private javax.swing.JButton btnLogout;
    private javax.swing.JButton btnOccupied;
    private javax.swing.JButton btnRefreshCandidateList;
    private javax.swing.JButton btnRefreshCompanyList;
    private javax.swing.JButton btnUpdateCandidate;
    private javax.swing.JButton btnUpdateCompany;
    private javax.swing.JComboBox cbCandidate;
    private javax.swing.JComboBox cbCandidate1Checkin;
    private javax.swing.JComboBox cbCandidate2Checkin;
    private javax.swing.JComboBox cbCandidate3CheckIn;
    private javax.swing.JComboBox cbCandidate4CheckIn;
    private javax.swing.JComboBox cbCandidate5CheckIn;
    private javax.swing.JComboBox cbCandidate6CheckIn;
    private javax.swing.JComboBox cbCandidateCheckout;
    private javax.swing.JComboBox cbCompany;
    private javax.swing.JComboBox cbCompanyCheckin;
    private javax.swing.JComboBox cbRoom;
    private javax.swing.JLabel jLabel1lblCheckOut;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JLabel lblCandidateList;
    private javax.swing.JLabel lblCheckIn;
    private javax.swing.JLabel lblCloseSysCandidate;
    private javax.swing.JLabel lblCloseSysCompany;
    private javax.swing.JLabel lblCompanyList;
    private javax.swing.JLabel lblInsertCandidate;
    private javax.swing.JLabel lblInsertCompany;
    private javax.swing.JLabel lblInterviewerCount;
    private javax.swing.JLabel lblOpenSysCandidate;
    private javax.swing.JLabel lblOpenSysCompany;
    private javax.swing.JLabel lblRoom;
    private javax.swing.JLabel lblStatusCheckin;
    private javax.swing.JLabel lblStatusCheckout;
    private javax.swing.JLabel lblTitleCandidateCheckout;
    private javax.swing.JLabel lblTitleCompanyCheckIn;
    private javax.swing.JList listCloseSysCandidate;
    private javax.swing.JList listCloseSysCompany;
    private javax.swing.JList listOpenSysCandidate;
    private javax.swing.JList listOpenSysCompany;
    private javax.swing.JMenuItem menuRemove;
    private javax.swing.JMenuItem menuRemove2;
    private javax.swing.JMenuItem menuToggleDone;
    private javax.swing.JMenuItem menuToggleDone2;
    private javax.swing.JPanel pnlCandidate;
    private javax.swing.JPanel pnlCompany;
    private javax.swing.JPanel pnlContainer;
    private javax.swing.JPanel pnlInterview;
    private javax.swing.JPopupMenu popCandidate;
    private javax.swing.JPopupMenu popCompany;
    private javax.swing.JRadioButton radioCloseCandidate;
    private javax.swing.JRadioButton radioCloseCompany;
    private javax.swing.JRadioButton radioOpenCandidate;
    private javax.swing.JRadioButton radioOpenCompany;
    private javax.swing.JSpinner spinInterviewerCount;
    private javax.swing.JTable tblCandidate;
    private javax.swing.JTable tblCompany;
    private javax.swing.JToggleButton tbtnCandidatePresent;
    private javax.swing.JToggleButton tbtnCompanyPresent;
    private javax.swing.JTextField txtCandidateName;
    private javax.swing.JTextField txtCompanyName;
    // End of variables declaration//GEN-END:variables

    private void refreshCandidateScreen() {
        //initialize screen
        try{
            while (tblCandidate.getRowCount()>0){
                 ((DefaultTableModel) tblCandidate.getModel()).removeRow(0);
            }
//                String[] tableColumnsName = {"Name","IsPresent","IsOccupied"};
//            ((DefaultTableModel) tblCandidate.getModel()).setColumnIdentifiers(tableColumnsName);
            ResultSet mySet = PostGre_func.getInstance().getCandidate();
            while (mySet.next()) {
                 Object[] objects = new Object[3];
                 for(int i=1;i<4;i++){
                     objects[i-1]=mySet.getObject(i+1);
                 }
                 ((DefaultTableModel) tblCandidate.getModel()).addRow(objects);
            }
            
            cbCompany.removeAllItems();
            mySet = PostGre_func.getInstance().getCompany();
            List<String> companyList = new ArrayList<>();
            while (mySet.next())
                    companyList.add(mySet.getString(2));
            Object[] list = companyList.toArray();
            for (int i=0;i<list.length;i++)
                cbCompany.addItem(list[i]);
        } catch (SQLException ex) {
            java.util.logging.Logger.getLogger("pmbs.CareerDay").log(java.util.logging.Level.SEVERE, null, ex);
        }    
        
        ((DefaultListModel) listCloseSysCompany.getModel()).clear();
        ((DefaultListModel) listOpenSysCompany.getModel()).clear();
        
        txtCandidateName.setText("");
        removedCandidateID.clear();
        btnInsertCandidate.setEnabled(false);
        btnUpdateCandidate.setEnabled(false);
        btnDeleteCandidate.setEnabled(false);
    }
    
    private void refreshCompanyScreen() {
        //initialize screen
        try{
            while (tblCompany.getRowCount()>0){
                 ((DefaultTableModel) tblCompany.getModel()).removeRow(0);
            }
//                String[] tableColumnsName = {"Name","IsPresent"};
//            ((DefaultTableModel) tblCompany.getModel()).setColumnIdentifiers(tableColumnsName);
            ResultSet mySet = PostGre_func.getInstance().getCompany();
            while (mySet.next()) {
                 Object[] objects = new Object[2];
                 for(int i=1;i<3;i++){
                     objects[i-1]=mySet.getObject(i+1);
                 }
                 ((DefaultTableModel) tblCompany.getModel()).addRow(objects);
            }
            
            cbCandidate.removeAllItems();
            mySet = PostGre_func.getInstance().getCandidate();
            List<String> candidateList = new ArrayList<>();
            while (mySet.next())
                candidateList.add(mySet.getString(2));
            Object[] list = candidateList.toArray();
            for (int i=0;i<list.length;i++)
                cbCandidate.addItem(list[i]);
        } catch (SQLException ex) {
            java.util.logging.Logger.getLogger("pmbs.CareerDay").log(java.util.logging.Level.SEVERE, null, ex);
        }    
        
        ((DefaultListModel) listCloseSysCandidate.getModel()).clear();
        ((DefaultListModel) listOpenSysCandidate.getModel()).clear();
        
        txtCompanyName.setText(""); 
        removedCompanyID.clear();
        btnInsertCompany.setEnabled(false);
        btnUpdateCompany.setEnabled(false);
        btnDeleteCompany.setEnabled(false);

    }
    
    private void refreshInterviewScreen() {
        //initialize screen
        // disable all component first
        cbCandidate1Checkin.setEnabled(false);
        cbCandidate2Checkin.setEnabled(false);
        cbCandidate3CheckIn.setEnabled(false);
        cbCandidate4CheckIn.setEnabled(false);
        cbCandidate5CheckIn.setEnabled(false);        
        cbCandidate6CheckIn.setEnabled(false);
        
        btnInterviewerUpdate.setEnabled(false);
        btnCheckin1.setEnabled(false);
        btnCheckIn2.setEnabled(false);
        btnCheckIn3.setEnabled(false);
        btnCheckIn4.setEnabled(false);
        btnCheckIn5.setEnabled(false);
        btnCheckIn6.setEnabled(false);
        
        btnIdle.setEnabled(false);
        btnOccupied.setEnabled(false);
        
        tbtnCandidatePresent.setEnabled(false);
        tbtnCompanyPresent.setEnabled(false);
        //cbRoom.setEnabled(false);
        //spinInterviewerCount.setEnabled(false);
        
        //fill company and candidate name in the combobox
        ResultSet companySet = PostGre_func.getInstance().getCompany();
        ResultSet candidateSet = PostGre_func.getInstance().getCandidate();
        
        try {
            cbCompanyCheckin.removeAllItems();
            while (companySet.next()) {
                cbCompanyCheckin.addItem(companySet.getObject(2));
            }
            
            cbCandidateCheckout.removeAllItems();
            while (candidateSet.next()) {
                cbCandidateCheckout.addItem(candidateSet.getObject(2));
            }
        } catch (SQLException ex) {
            java.util.logging.Logger.getLogger("pmbs.CareerDay").log(java.util.logging.Level.SEVERE, null, ex);            
        }
        
        fillInterviewRoom();
    }
    
    private void fillInterviewRoom () {
        try {
            ResultSet myRS = PostGre_func.getInstance().getLocation();
            cbRoom.removeAllItems();
            while (myRS.next()) {
                cbRoom.addItem(myRS.getString(1));
            }
        } catch (SQLException ex) {
            Logger.getLogger("pmbs.CareerDay").log(Level.SEVERE, null, ex);
        }
    }
}
